package com.ctrl.riveradministrator.mvp.view.activity.splash;

import android.Manifest;
import android.content.Context;

import android.os.Build;
import android.os.Message;
import android.os.Bundle;
import android.view.View;

import com.ctrl.riveradministrator.R;
import com.ctrl.riveradministrator.base.BaseActivity;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.RaApplication;
import com.ctrl.riveradministrator.mvp.view.activity.login.LoginActivity;
import com.ctrl.riveradministrator.MainActivity;

public class SplashActivity extends BaseActivity {

    @Override
    protected void initParams(Bundle parms) {
    }

    @Override
    protected int bindLayout() {
        return R.layout.activity_splash;
    }

    @Override
    protected void initView(View view) {
    }

    @Override
    protected void doBusiness(Context mContext) {
        new android.os.Handler().postDelayed(()->{
            if (RaApplication.getUserId() != null) {
                startActivity(MainActivity.class);
            } else {
                startActivity(LoginActivity.class);
            }
            finish();
        }, 3000);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 3000);
        }

    }

    @Override
    protected void widgetClick(View view) {

    }

    @Override
    protected void setListener() {

    }

    @Override
    public void handleMessage(Message message, int what) {

    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

}
